package com.zl.autocode.controller.autocode;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.zl.autocode.controller.base.AutocodeBaseController;
import com.zl.autocode.dto.autocode.tableColumn.ReqTableColumnAddDTO;
import com.zl.autocode.dto.autocode.tableColumn.ReqTableColumnDelDTO;
import com.zl.autocode.dto.autocode.tableColumn.ReqTableColumnDetailDTO;
import com.zl.autocode.dto.autocode.tableColumn.ReqTableColumnEditDTO;
import com.zl.autocode.dto.autocode.tableColumn.ReqTableColumnQueryDTO;
import com.zl.autocode.dto.autocode.tableColumn.ReqTableColumnStateDTO;
import com.zl.autocode.dto.autocode.tableColumn.ResTableColumnAddDTO;
import com.zl.autocode.dto.autocode.tableColumn.ResTableColumnDelDTO;
import com.zl.autocode.dto.autocode.tableColumn.ResTableColumnDetailDTO;
import com.zl.autocode.dto.autocode.tableColumn.ResTableColumnEditDTO;
import com.zl.autocode.dto.autocode.tableColumn.ResTableColumnQueryDTO;
import com.zl.autocode.dto.autocode.tableColumn.ResTableColumnStateDTO;
import com.zl.autocode.service.autocode.ITableColumnService;
import com.zl.common.dto.ReqDTO;
import com.zl.common.dto.ResDTO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 数据库表属性信息
 * @author ZL
 */
@Api(value="数据库表属性信息",tags ="数据库表属性信息")
@RestController("autocodeTableColumnController")
@RequestMapping("/autocode/tableColumn")
public class TableColumnController extends AutocodeBaseController {

    @Autowired
    private ITableColumnService tableColumnService;
    
    /**
     * 查询
     */
    @ApiOperation(value="数据库表属性信息-查询")
    @RequestMapping(value="/list", method = RequestMethod.POST)
    public ResDTO<ResTableColumnQueryDTO> listTableColumn(@RequestBody ReqDTO<ReqTableColumnQueryDTO> reqInfo) throws Exception{
        ResTableColumnQueryDTO data = tableColumnService.queryTableColumnList(reqInfo);
        return successDATA(data);
    }
    
   /**
     * 详情
     */
    @ApiOperation(value="数据库表属性信息-详情")
    @RequestMapping(value="/detail", method = RequestMethod.POST)
    public ResDTO<ResTableColumnDetailDTO> detailTableColumn(@RequestBody ReqDTO<ReqTableColumnDetailDTO> reqInfo) throws Exception{
        ResTableColumnDetailDTO data = tableColumnService.queryTableColumnDetail(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 新增
     */
    @ApiOperation(value="数据库表属性信息-新增")
    @RequestMapping(value="/add", method = RequestMethod.POST)
        public ResDTO<ResTableColumnAddDTO> addTableColumn(@RequestBody ReqDTO<ReqTableColumnAddDTO> reqInfo) throws Exception{
        ResTableColumnAddDTO data = tableColumnService.insertTableColumnInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 编辑
     */
    @ApiOperation(value="数据库表属性信息-编辑")
    @RequestMapping(value="/edit", method = RequestMethod.POST)
        public ResDTO<ResTableColumnEditDTO> editTableColumn(@RequestBody ReqDTO<ReqTableColumnEditDTO> reqInfo) throws Exception{
        ResTableColumnEditDTO data = tableColumnService.updateTableColumnInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 删除
     */
    @ApiOperation(value="数据库表属性信息-删除")
    @RequestMapping(value="/del", method = RequestMethod.POST)
        public ResDTO<ResTableColumnDelDTO> delTableColumn(@RequestBody ReqDTO<ReqTableColumnDelDTO> reqInfo) throws Exception{
        ResTableColumnDelDTO data = tableColumnService.deleteTableColumnInfo(reqInfo);
        return successDATA(data); 
    }
    
    /**
     * 状态更新
     */
    @ApiOperation(value="数据库表属性信息-状态更新")
    @RequestMapping(value="/state", method = RequestMethod.POST)
        public ResDTO<ResTableColumnStateDTO> stateTableColumn(@RequestBody ReqDTO<ReqTableColumnStateDTO> reqInfo) throws Exception{
        ResTableColumnStateDTO data = tableColumnService.updateTableColumnState(reqInfo);
        return successDATA(data); 
    }
    
    
}